/*
 * Copyright 2009 BioTeam Inc
 * 
 * Licensed under License GNU LESSER GENERAL PUBLIC LICENSE version 3.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.gnu.org/copyleft/lesser.html
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package net.bioteam.appweb;

import java.io.InputStream;

import net.bioteam.appweb.TestConfig;
import net.bioteam.appweb.acd.AcdToProgram;
import net.bioteam.appweb.model.Parameter;
import net.bioteam.appweb.model.Program;
import net.bioteam.appweb.model.ProgramBuilder;
import net.bioteam.appweb.model.XmlToProgram;
import net.bioteam.appweb.submit.DefaultCommandLineGenerator;
import net.bioteam.appweb.submit.ProgramValueBean;
import net.bioteam.appweb.submit.UnfinishedJob;

import net.sf.ehcache.CacheManager;
import junit.framework.TestCase;

public class Test extends TestCase {

	public Test(String name) {
		super(name);
	}

	public void setUp() throws Exception {
		TestConfig.UnixInit();
	
	}

	public void tearDown() throws Exception {
		TestConfig.shutdown();
	}

	public static void main(String args[]) {
		Test test = new Test("testPerlEval");
		junit.textui.TestRunner.run(test);
	}
	public void testPerlEval() throws Exception
	{
		Program program;
		Parameter p;
		UnfinishedJob job=new UnfinishedJob();
		job.setWorkdir("/tmp");
		DefaultCommandLineGenerator generator = new DefaultCommandLineGenerator();
		String cmdline, expected;
		ProgramValueBean bean;
	
		ProgramBuilder.cache.remove("lucy");
		program = ProgramBuilder.getProgram("lucy");
		bean=new ProgramValueBean(program);

		bean.setValue("vector_splice", "PUC19splice");
		bean.setValue("vector_seq", "PUC19");
		bean.setValue("sequence", "atie.seq");
		bean.setValue("sequence2", "atie.2nd");
		bean.setValue("quality_file", "atie.qul");
		
		cmdline=generator.generateScript(bean, job);
		System.out.println(cmdline);
		
		ProgramBuilder.cache.remove("lucy");
		program = ProgramBuilder.getProgram("lucy");
		bean=new ProgramValueBean(program);

		bean.setValue("vector_splice", "PUC19splice");
		bean.setValue("vector_seq", "PUC19");
		bean.setValue("sequence", "atie.seq");
		bean.setValue("sequence2", "atie.2nd");
		bean.setValue("quality_file", "atie.qul");
		bean.setValue("pass_along", "5 6 x");
		
		cmdline=generator.generateScript(bean, job);
		System.out.println(cmdline);
	}
}

